package rtmp;

import util.Common;
import org.apache.log4j.Logger;

public class RtmpBytesRead extends Amf{

    private static final Logger logger = Logger.getLogger(RtmpBytesRead.class);

    public int getLen() {
        return len;
    }

    private int len = 0;

    public void setBytesRead(byte[] message) {
//        logger.error("bytes read");
        setAmfClass(message);
        if (amfClass.pos + 4 > amfClass.message.length) {
            logger.error("数据不足");
        }
        logger.error(Common.bytes2hex(amfClass.message));
        byte[] number2 = new byte[4];
        int index2 = 0;
        for (int i = amfClass.pos; i < amfClass.pos + 4; i++) {
            number2[index2] = amfClass.message[i];
            index2++;
        }
        int len = Common.byteToInt(number2);
//        logger.error("len" + len);
        this.len = len;
    }
}
